<template>
	<view>
		<bg-video></bg-video>
		<cu-custom :isBack="false">
			<block slot="content">24h棋牌室</block>
		</cu-custom>
		<view class="vw-100 vh-100">
			<view style="bottom: 0; left: 0;" class="position-absolute p-2 w-100">
				<button @click="toHome" class="w-100 btn btn-primary">点击进入</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		onLoad: function() {
			this.autorLogin();
		},
		onShareAppMessage: function(res) {
			return {
				title: '羽毛球',
				path: '/pages/index'
			};
		},
		onShow: function() {},
		methods: {
			getUserInfo: async function() {
				return new Promise((resolve, reject) => {
					uni.getUserProfile({
						desc: '用于完善会员资料',
						success: res => {
							console.log(res);
						},
						fail: err => {
							console.log(err);
						}
					})
				});
			},
			autorLogin: function() {
				uni.login({
					success: res => {
						let URL =
							'https://api.weixin.qq.com/sns/jscode2session?appid=wx19118b079911ae30&secret=2a2a30b6c2259bb5253c75cde14f884a&js_code=' +
							res.code + '&grant_type=authorization_code'
						uni.request({
							url: URL,
							success: data => {
								console.log(data);
							},
							fail: err => {
								uni.showToast({
									title: '请求openId失败',
									duration: 2000
								});
								this.$tab.redirectTo(`/pages/login`);
							},
						});
					}
				});
			},
			toHome: function() {
				uni.reLaunch({
					url: "../pages/home"
				});
			}


		}
	}
</script>

<style scoped>

</style>